#include "head.h"
void tail_insert(QueueLink*q,int data,transport_protocol_t msg){
    
    QueueNode*newnode=(QueueNode*)malloc(sizeof(QueueNode));
    newnode->data=data;
    newnode->msg=msg;
    newnode->next=NULL;
    if(q->head==NULL){
    q->head=newnode;
    q->tail=newnode;
    q->size++;
    return ;
    }
    q->tail->next=newnode;
    q->tail=newnode;
    q->size++;
}
int enqueue(QueueLink*q,transport_protocol_t*msg){
    if(q->size>0){
        
        int value=q->head->data;
       *msg=q->head->msg;
        QueueNode*temp=q->head;
        q->head=q->head->next;
        free(temp);
        if(q->size==1){
            q->tail=NULL;
        }
        q->size--;
        return value;
    }
    return 0;
}
